﻿using System;
using System.Collections.Generic;
using System.Xml.Linq;

namespace YArchitech.Temp
{
	public class HYAccessories : List<HYAccessory>, IHYXmlSerial
	{
		public double GetCoefficient()
		{
			double num = 0.0;
			foreach (HYAccessory hyaccessory in this)
			{
				num += hyaccessory.Coefficient;
			}
			return num;
		}

		public void WriteXml(XElement xe)
		{
			xe.RemoveNodes();
			foreach (HYObject hyobject in this)
			{
				XElement xelement = new XElement("Accessory");
				hyobject.WriteXml(xelement);
				xe.Add(xelement);
			}
		}

		public void ReadXml(XElement xe)
		{
			base.Clear();
			foreach (XElement xe2 in xe.Elements("Accessory"))
			{
				HYAccessory hyaccessory = new HYAccessory();
				hyaccessory.ReadXml(xe2);
				base.Add(hyaccessory);
			}
		}
	}
}
